package com.source.scalaakka.basic

import akka.actor.{Actor, ActorSystem, Props}

/**
  * Description: 
  * User: tan 
  * DateTime: 2018/1/19 19:09 
  */
object Hello {

  class HelloActor extends Actor {
    override def receive: Receive = {
      case "hello" => println("hello back to you.")
      case _ => println("huh?")
    }
  }

  def test: Unit = {
    val system = ActorSystem("HelloSystem")

    //create an start actor
    val helloActor = system.actorOf(Props[HelloActor], name = "helloActor")

    //发送信息
    helloActor ! "hello"

    helloActor ! "what"
  }
}
